<?php 
/**
 * 用户相关服务类
 * @author zlian
 *
 */
namespace Users\Service;
class UsersService{
	
	//private $user;
	//private $sms;
	
	public function __construct() {
		//$this->user = D('Users');
	}
	
	//判断是否登录
	public function isLogin(){
		if(session('loginUser')){
			return true;
		}else{
			return false;
		}
	}
	
	//获取现在登录用户信息
	public function getCurrentUser(){
		if($this->isLogin()){
			return D('Users')->find(session('loginUser.uid'));	
		}
	}
	
	//根据用户id获取用户的权限列表
	public function getAuthRoles($uid){
		$access = M('AuthGroupAccess')->where('uid = '.$uid) ->find();
		$rules = M('AuthGroup')->field('rules')->find($access['group_id']);
		return $rules['rules'];
	}
}
?>